package com.huarui.part.dao.impl;

import java.util.List;
import java.util.Map;

import org.ewaf.framework.dao.impl.BaseDaoImpl;

import com.huarui.part.dao.ICarModelDao;
import com.huarui.part.model.CarModel;

public class CarModelDao extends BaseDaoImpl implements ICarModelDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<CarModel> searchCarModels(String key) {
		if (key == null || "".equals(key.trim())) {
			return this.getSqlMapClientTemplate().queryForList(
					namespace + ".getAll");
		} else {

			return this.getSqlMapClientTemplate().queryForList(
					namespace + ".search", key);
		}

	}

	@Override
	@SuppressWarnings("unchecked")
	public List<Map<String, Object>> getCarModelListByComplex(
			Map<String, Object> paramsMap) {
		return this.getSqlMapClientTemplate().queryForList(super.namespace + ".getCarModelListByComplex", paramsMap);
	}

	@Override
	public Integer getCarModelListCountByComplex(Map<String, Object> paramsMap) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(super.namespace + ".getCarModelListCountByComplex", paramsMap);
	}

}
